import { ApiProperty } from '@nestjs/swagger'
import { IsBoolean, IsNumber, IsOptional, IsString } from 'class-validator'
import { Column, CreateDateColumn, Entity, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm'

@Entity('invitation')
export class Invitation {
  @PrimaryGeneratedColumn()
  @IsNumber()
  invitationId: number

  /**
   * 排序
   */
  @ApiProperty({ default: 0 })
  @Column({ default: 0, nullable: true })
  @IsNumber()
  @IsOptional()
  invitationSort: number

  /**
   * 邀请人数
   */
  @Column()
  @IsNumber()
  invitationCount: number

  /**
   * 邀请人数已到达
   */
  @ApiProperty({ default: false })
  @Column({ default: false })
  @IsBoolean()
  @IsOptional()
  invitationCountSuccess: boolean

  /**
   * 奖品描述（换行逗号拼接）
   */
  @Column({ nullable: true })
  @IsString()
  @IsOptional()
  giftDescription?: string

  @CreateDateColumn()
  createdAt?: Date

  @UpdateDateColumn()
  updatedAt?: Date
}
